---
import { getEntry, render } from "astro:content";
import BlogPostLayout from "../../layouts/BlogPostLayout.astro";

const { slug = "" } = Astro.params;

const entry = await getEntry("blog", slug);

if (entry === undefined) {
  return Astro.redirect("/404");
}

const { Content, remarkPluginFrontmatter, headings } = await render(entry);
---
<BlogPostLayout frontmatter={remarkPluginFrontmatter} headings={headings}>
    <Content/>
</BlogPostLayout>
